//
//  YxrDatePicker.swift
//  YXRSmartDeviceDemo
//
//  Created by run on 2024/7/9.
//

import SwiftUI

struct YxrDatePicker: View {
    let title: String
    @Binding var date: Date

    init(title: String, date: Binding<Date>) {
        self.title = title
        _date = date
    }

    var body: some View {
        DatePicker(selection: $date) {
            Text(title)
                .font(.body)
                .foregroundColor(.secondary)
                .frame(minWidth: 80, alignment: .leading)
        }
        .environment(\.locale, Locale(identifier: "zh_CN"))
        .datePickerStyle(.automatic)
        .padding(.horizontal, 20.0)
    }
}
